package com.com.knowledgepaymentmanagementsystem.service.bill.impl;

import com.com.knowledgepaymentmanagementsystem.mapper.bill.BillMapper;
import com.com.knowledgepaymentmanagementsystem.pojo.bill.Bill;
import com.com.knowledgepaymentmanagementsystem.pojo.courseshop.CourseShop;
import com.com.knowledgepaymentmanagementsystem.service.bill.BillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 张攀
 * @version 1.0
 * @description: TODO
 * @date 2025/9/23 上午10:27
 */
@Service
public class BillServiceImpl implements BillService {

    @Autowired
    private BillMapper billMapper;
    @Override
    public List<Bill> findBills(Bill bill) {
        return billMapper.findBills(bill);
    }

    @Override
    public Object insertBills(Bill bill) {
       return billMapper.insert(bill);
    }

    @Override
    public void deleteBills(Integer id) {
      billMapper.deleteById(id);
    }

    @Override
    public void updateBills(Bill bill) {
        billMapper.updateById(bill);
    }

    @Override
    public void insertShopBills(CourseShop courseShop) {
        Bill bill = new Bill();
        bill.setBillInfo(courseShop.getName());
        bill.setUserInfo(courseShop.getUserInfo());
        bill.setBillForm(courseShop.getBillForm());
        bill.setBillWay(courseShop.getBillWay());
        bill.setBillState(1);
        billMapper.insert(bill);
    }


}
